package com.sos.dao;


import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
/***
 * 数据库操作类
 * **/
public class DatabaseHelper extends SQLiteOpenHelper{
	private final String TAG = DatabaseHelper.class.getSimpleName();
	private final static int version = 2;
	private final static String DB_FILE = "sos.db";
	/**
	 * 构造函数
	 * @param context
	 */
	public DatabaseHelper(Context context) {
		super(context, DB_FILE, null, version);
	}

	public DatabaseHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
	}

	
	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		Log.i(TAG, "onCreate");
		
		//创建 contactor
		StringBuffer sb = new StringBuffer();
		sb.append("create table contactor (");
		sb.append("id integer primary key,");
		sb.append("name text,");
		sb.append("phone text,");
		sb.append("type integer");
		sb.append(")");
		Log.d(TAG, sb.toString());
		db.execSQL(sb.toString());
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub
		
	}

}
